Return Values: Custom hooks should return values (state variables, functions, etc.) that the consuming component can use.
You're writing a simple custom hook that fetches data on mount. What should the hook return so the component can use the data and loading state?
If you need to expose a ref to a child component via a custom hook, how would you structure the return value?
Your team added a custom hook that returns an object with several callbacks, but the component re-renders on every render. What might be wrong with what the hook returns, and how would you fix it?
A bug appears where a component using a custom hook gets a stale value after a state update. Explain how the hook's return shape could cause this and what you would change.
Design a custom hook for form handling that needs to expose field values, error messages, and a submit handler. Discuss the trade‑offs of returning an array vs an object, and how you’d ensure stability for consumers.
In a large codebase, you notice many custom hooks returning raw values mixed with functions, leading to inconsistent usage. How would you refactor the return contracts to improve type safety and maintainability across teams?
Your organization is standardizing hook APIs across multiple product lines. What guidelines would you set for what a custom hook should return, considering memoization, TypeScript typing, and backward compatibility?
A legacy custom hook returns a mutable object that callers modify, causing hidden side effects. How would you redesign its return contract to enforce immutability and avoid breaking existing consumers?